/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.eng.scc.core.data;

import com.eng.scc.core.db.manager.service.FuelControllerManagerService;
import java.sql.Date;

/**
 *
 * @author Rafael
 */
public class Driver extends Skeleton
{
    public static int ACTIVE = 0;
    public static int INACTIVE = 1;
    
    private int peopleId;

    private int companyId;
    private String cnh = "";
    private Date cnhDue;
    private String cnhCategory = "";
    private double defaultComission;
    private short state;
    
    public int getPeopleId()
    {
        return peopleId;
    }

    public void setPeopleId( int pplId )
    {
        this.peopleId = pplId;
    }

    public int getCompanyId()
    {
        return companyId;
    }

    public void setCompanyId( int companyId )
    {
        this.companyId = companyId;
    }

    public String getCnh()
    {
        return cnh;
    }

    public void setCnh( String cnh )
    {
        this.cnh = cnh;
    }

    public Date getCnhDue()
    {
        return cnhDue;
    }

    public void setCnhDue( Date cnhDue )
    {
        this.cnhDue = cnhDue;
    }

    public String getCnhCategory()
    {
        return cnhCategory;
    }

    public void setCnhCategory( String cnhCategory )
    {
        this.cnhCategory = cnhCategory;
    }

    public double getDefaultComission()
    {
        return defaultComission;
    }

    public void setDefaultComission( double defaultComission )
    {
        this.defaultComission = defaultComission;
    }

    public short getState()
    {
        return state;
    }

    public void setState( short state )
    {
        this.state = state;
    }

    @Override
    public String toString()
    {
        try
        {
            if ( peopleId > 0 )
            {
                People p = FuelControllerManagerService.getInstance().getPeople( peopleId );

                if ( p != null )
                {
                    return p.getName();
                }
            }
        
        }
        catch ( Exception e )
        {
        }
        
        return "n/d";
    }

    @Override
    public boolean equals( Object obj )
    {
        if ( obj == null )
        {
            return false;
        }
        if ( getClass() != obj.getClass() )
        {
            return false;
        }
        final Driver other = ( Driver ) obj;
        if ( this.getId() != other.getId() )
        {
            return false;
        }
        return true;
    }
}
